import request from '@/utils/request'
// 数据概览需要的接口

export const refreshAdvReports = (quey) => {
  return request({
    method: 'get',
    url: '/adv/refreshAdvReports',
    params: quey,
    timeout: 30000
  })
}


// 获取该团队的自助投放下的所有广告组数据及其上级
export const findTeamAdgroup = (quey) => {
  return request({
    method: 'get',
    url: '/campaignGroup/findTeamAdgroup',
    params: quey,
    timeout: 30000
  })
}



// 获取所有秘钥以及下属的所有org
export const findAcOrOrgList = (quey) => {
  return request({
    method: 'get',
    url: '/secretAccount/findAcOrOrgList',
    params: quey,
    timeout: 30000
  })
}


// 获取所有的秘钥
export const findOrgAccountAll = (quey) => {
  return request({
    method: 'get',
    url: '/secretAccount/findList',
    params: quey,
    timeout: 30000
  })
}

// 获取所有OrgID
export const findOrgAll = (quey) => {
  return request({
    method: 'get',
    url: '/secretAccount/findOrgList',
    params: quey,
    timeout: 30000
  })
}


// 查询所有的广告系列组
export const findSerialAll = (quey) => {
  return request({
    method: 'get',
    url: '/campaignGroup/find',
    params: quey,
    timeout: 30000
  })
}

//  获取美元中国的所有广告系列组
export const findcampaignGroudAll = (quey) => {
  return request({
    method: 'get',
    url: 'campaignGroup/team/find',
    params: quey,
    timeout: 30000
  })
}
// 创建广告系列组
export const addSerial = (data) => {
  return request({
    method: 'post',
    url: '/campaignGroup/add',
    data,
    timeout: 30000
  })
}

// 编辑单个广告系列组
export const editSerial = (data) => {
  return request({
    method: 'post',
    url: '/campaignGroup/modify',
    data,
    timeout: 30000
  })
}

// 删除单个广告系列组
export const removeSerial = (data) => {
  return request({
    method: 'post',
    url: '/campaignGroup/remove',
    data,
    timeout: 30000
  })
}







// 查询所有广告系列 邀请用户专用
export const findReceiveCampaign = (quey) => {
  return request({
    method: 'get',
    url: '/campaign/findReceiveCampaign',
    params: quey,
    timeout: 30000
  })
}


// Campaigns模块

//  根据appid、orgId查询全部Campaign   头部选择全部广告系列组de
export const findCampaign = (quey) => {
  return request({
    method: 'get',
    url: '/campaign/findCampaign',
    params: quey,
    timeout: 30000
  })
}


// 表格模块

// 获取广告系列组
export const findReportCampaignList = (quey) => {
  return request({
    method: 'get',
    url: '/reports/findReportCampaignList',
    params: quey,
  })
}

// 获取广告系列组  表格下方总计数据的接口
export const findReportCampaignListTotal = (quey) => {
  return request({
    method: 'get',
    url: '/reports/findReportCampaignListTotal',
    params: quey,
  })
}

// 下载广告系列组数据
export const downloadCampaignCsv = (quey) => {
  return request({
    method: 'get',
    url: '/reports/downloadCampaignCsv',
    params: quey,
  })
}


// 删除广告系列组数据
export const removeCampaign = (data) => {
  return request({
    method: 'post',
    url: '/campaign/remove',
    data,
  })
}


// 更改广告系列组数据
export const modifyCampaign = (data) => {
  return request({
    method: 'post',
    url: '/campaign/modify',
    data,
  })
}



// 根据广告系列组id获取广告组
export const findReportAdGroupList = (quey) => {
  return request({
    method: 'get',
    url: '/reports/findReportAdGroupList',
    params: quey,
  })
}

// 根据广告系列组id获取广告组  表格的统计数据
export const findReportAdGroupListTotal = (quey) => {
  return request({
    method: 'get',
    url: '/reports/findReportAdGroupListTotal',
    params: quey,
  })
}

// 下载根据广告系列组id获取广告组的数据
export const downloadAdGroupCsv = (quey) => {
  return request({
    method: 'get',
    url: '/reports/downloadAdGroupCsv',
    params: quey,
  })
}






// 批量删除广告组数据
export const removeAdgroups = (data) => {
  return request({
    method: 'post',
    url: '/adgroups/remove',
    data,
  })
}


// 批量更改广告组数据
export const modifyAdgroups = (data) => {
  return request({
    method: 'post',
    url: '/adgroups/modify',
    data,
  })
}



// 根据orgid、campaignId查询全部Adgroups
export const findAdgroupsList = (quey) => {
  return request({
    method: 'get',
    url: '/adgroups/findList',
    params: quey,
  })
}

// 根据orgid、adgroupId查询某个Adgroups
export const findAdgroupsOne = (quey) => {
  return request({
    method: 'get',
    url: '/adgroups/findOne',
    params: quey,
  })
}

/* 图表模块 */
// 查询所有campaign的图表数据
export const findReportCampaignTotal = (quey) => {
  return request({
    method: 'get',
    url: '/reports/findReportCampaignTotal',
    params: quey,
  })
}



// 获取全部广告组图表数据---日期
export const findReportAdGroupTotal = (quey) => {
  return request({
    method: 'get',
    url: '/reports/findReportAdGroupTotal',
    params: quey,
  })
}


// 获取全部广告组图表数据---根据受众
export const findReportCampaignTotalAudienceType = (quey) => {
  return request({
    method: 'get',
    url: '/reports/findReportCampaignTotalAudienceType',
    params: quey,
  })
}

// 获取全部广告组图表数据---根据广告组
export const findReportAdGroupTotalBySearch = (quey) => {
  return request({
    method: 'get',
    url: '/reports/findReportAdGroupTotalBySearch',
    params: quey,
  })
}


export const findKeyordsList = (quey) => {
  return request({
    method: 'get',
    url: '/keyords/findList',
    params: quey,
  })
}



// 获取全部关键词图表数据---根据关键词Id获取日期图表数据
export const findReportKeywordTotalBySearch = (quey) => {
  return request({
    method: 'get',
    url: '/reports/findReportKeywordTotalBySearch',
    params: quey,
  })
}


// 单个广告组详情---根据受众选择获取图表数据
export const findReportAdGroupTotalAudienceType = (quey) => {
  return request({
    method: 'get',
    url: '/reports/findReportAdGroupTotalAudienceType',
    params: quey,
  })
}





// name名称,adam_id用户id,
// countries_or_regions投放国际/地区,
// display_status展示状态,
// budget_amount总预算,
// daily_budget_amount每日预算,
// impressions展示,
// taps点击数,
// installs下载,
// new_downloads新下载,
// redownloads重复下载,
// lat_onInstalls开启广告追踪下载,
// lat_offInstalls开启广告追踪下载,
// avg_cpa_amount平均激活成本,
// avg_cpa_currencyCPA货币,
// avg_cpt_amount平均点击成本,
// avg_cpt_currencyCPT货币,
// local_spend_amount花费,
// local_spend_currency花费货币,
// conversion_rate转化率,
// ttr点击率


// avgCpaAmount: 平均激活成本
// avgCpaCurrency: CPA货币
// avgCptAmount:  平均点击成本
// avgCptCurrency: CPT货币
// conversionRate: 转化率
// date: "2021-01-01"
// impressions展示,
// installs: 下载
// latOffinstalls: 关闭广告追踪下载
// latOninstalls: 0 开启广告追踪下载
// localSpendAmount 花费
// new_downloads新下载,
// redownloads重复下载,
// taps点击数,
// ttr点击率
